package com.zang.blogz.controller;

import com.zang.blogz.model.input.ro.AdminRegisterRO;
import com.zang.blogz.result.Result;
import com.zang.blogz.service.UserAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 橘贝贝
 * @Description: 用户注册模块
 * @DateTime: 2022/7/1 10:19
 **/
@Api(tags = "用户注册模块")
@RestController
@RequestMapping("/blogz/register")
public class AdminRegisterController {

    @Autowired
    private UserAuthService userAuthService;

    @ApiOperation(value = "注册接口", notes = "注册接口")
    @PostMapping("/")
    public Result<String> adminRegister(@RequestBody AdminRegisterRO adminRegisterRo) throws Exception {
        return userAuthService.adminRegister(adminRegisterRo);

    }

    @ApiOperation(value = "发送注册所用验证码接口", notes = "发送注册所用验证码接口")
    @GetMapping("/")
    public Result<String> getVerificationCode(@RequestParam(value = "email") String email) {
        return userAuthService.getVerificationCode(email);
    }
}
